package com.ludomancy.breathe;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import com.ludomancy.gamelib.Layout;
import com.ludomancy.gamelib.Widget;

public class MainWidget extends Widget
{
	public MainTextWidget mainText;
	public BannerWidget banner;
	public OptionsWidget options;
	
	private static int TEXT_MARGIN = 5;
	
	public MainWidget(Widget parent, Rectangle area)
	{
		super(parent, area);
		banner = new BannerWidget(this, new Rectangle(0,0, getWidth(), 60));
		options = new OptionsWidget(this, new Rectangle(0,0, 250, getHeight()-banner.getHeight()));
		mainText = new MainTextWidget(this, new Rectangle(TEXT_MARGIN,TEXT_MARGIN, getWidth()-options.getWidth() - TEXT_MARGIN*2, getHeight()-TEXT_MARGIN*2-banner.getHeight()), "", ((GameTheme)getTheme()).tinyFont);
		Widget[][] widgets = new Widget[][]
		{
			{banner},
			{mainText,options},
		};
		Layout.doLayout(widgets, 0, 0, 0);
	}
		
	public void update()
	{
		if(Game.game != null)
		{
			Game.game.update();
		}
	}
	
	public void paint(Graphics g)
	{
		g.setColor(new Color(0xE6E5D6));
		g.fillRect(0, 0, getWidth(), getHeight());
	}

}
